package com.hubei.dao.impl;

import com.hubei.dao.DepartmentDao;
import com.hubei.vo.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Title: DepartmentDaoImpl
 * @Author qzAI
 * @Package com.hubei.dao.impl
 * @Date 2025/6/28 14:13
 */
@Repository("departDao")
public class DepartmentDaoImpl implements DepartmentDao {

    @Autowired
    private JdbcTemplate template = null;

    @Override
    public int batchInsert(List<Department> list) {
        String sql = "insert into department(name) values(?)";
        int rows = 0;
        for(Department dept : list) {
            Object[] params = {dept.getName()};
            rows += template.update(sql,params);
        }

        return 0;
    }
}
